package com.xbongbong.saas.model;

import com.xbongbong.paas.domain.entity.PaasFormSubDataEntity;
import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.saas.domain.entity.ReturnedPurchaseSubDataEntity;
import org.elasticsearch.action.support.WriteRequest;

import java.util.List;
import java.util.Map;

/**
 * @author: xingxing.xiao
 * @date: 2020/09/17 16:45
 */
public interface ReturnedPurchaseSubDataModel extends IModel<ReturnedPurchaseSubDataEntity> {
    @Override
    Integer insert(ReturnedPurchaseSubDataEntity entity) throws XbbException;

    @Override
    Integer update(ReturnedPurchaseSubDataEntity entity) throws XbbException;

    @Override
    List<ReturnedPurchaseSubDataEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    Integer insertBatch(List<ReturnedPurchaseSubDataEntity> entities) throws XbbException;

    List<ReturnedPurchaseSubDataEntity> getByDataId(Long dataId, String corpid);

    List<ReturnedPurchaseSubDataEntity> getByDataIds(List<Long> dataIds, String corpid, DelEnum delEnum);

    Integer updateBatch(List<UpdateDataEntity> updateDataList, String corpid) throws XbbException;

    Integer deleteBatch(String corpid, List<ReturnedPurchaseSubDataEntity> entities, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;


    Integer deleteByDataId(Long dataId, String corpid) throws XbbException;

    Integer deleteBatchByDataId(List<Long> dataIds, String corpid, DelEnum delEnum) throws XbbException;

    void restoreBatch(List<Long> dataIds, String corpid) throws XbbException;

    /**
     * 更新del
     * @param updateDelList
     * @param corpid
     * @param refreshPolicy
     * @param delEnum
     * @return
     * @throws XbbException
     */
    Integer updateDel(List<ReturnedPurchaseSubDataEntity> updateDelList, String corpid, WriteRequest.RefreshPolicy refreshPolicy, DelEnum delEnum) throws XbbException;

    Integer updateBatchByEntity(List<? extends PaasFormSubDataEntity> list, String corpid) throws XbbException;
}
